package com.pafa.wiki.service;

import com.pafa.wiki.domain.Ebook;
import com.pafa.wiki.domain.EbookExample;
import com.pafa.wiki.mapper.EbookMapper;
import com.pafa.wiki.req.EbookReq;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EbookService {

    @Resource
    private EbookMapper ebookMapper;

    public List<Ebook>  list(EbookReq req){
        EbookExample ebookExample = new EbookExample();
        EbookExample.Criteria criteria = ebookExample.createCriteria();
        if (ObjectUtils.isEmpty(req.getName())){
            criteria.andNameLike("%"+req.getName()+"%");
        }
        return ebookMapper.selectByExample(ebookExample);}
}
